//遍历数组元素
var arr = ['tom','jerry','david','lucy','maria', 'lily','chris','scot'];
//0       1       2      3       4
//顺序号 ->下标
for(var i=0; i<arr.length; i++){
   //i [0~4]  0 1 2 arr[2]
   //console.log(i + '---' + arr[i]);
}
//从大到小
for(var i=arr.length-1;i>=0;i--){
  //console.log(i + '---' +arr[i]);
}
//使用for-in遍历数组
//遍历对象中的属性
for(var proName in arr){
  console.log(proName + '--' + arr[proName]);
}
//关联数组
/*
var arr1 = new Array();
arr1['name'] = 'tom';
arr1['age'] = 20;
arr1['sex'] = '男';
console.log(arr1);
*/
var person = [];
person['eid'] = '100';
person['ename'] = '李逵';
person['sex'] = '男';
person['age'] = 35;
person['phone'] = '18812345678';
person['dept'] = '开发部';
//console.log(person);
for(var proName in person){
  console.log(proName + '--' + person[proName]);
}






















